#pragma once

#include "Point3F.h"

#include "defines.h"

//#include "cuda_common.h"

#ifndef MAX_POINTS
#define MAX_POINTS 55
#endif

struct Seed {
	CPoint3F pos;
	CVector3F dir;
};

class CFiber
{
public:
	CPoint3F m_pF[MAX_POINTS];			/* forward points */
	CPoint3F m_pB[MAX_POINTS];			/* backward points */
	uint m_fCount;
	uint m_bCount;
	Seed m_seed;
	float m_threshold;

	CVector3F m_pFColor[MAX_POINTS];
	CVector3F m_pBColor[MAX_POINTS];

public:
	CFiber(void);
	~CFiber(void);

	void CreateFiber(const CPoint3F *pF, const CPoint3F *pB, 
		const uint fCount, const uint bCount, const Seed *seed);

	//void CreateFiber(const CUDA_Fiber *fiber);

	void ComputeColor();

	void CopyFiber(const CFiber *fiber);
};

void ReadConfigureFile(const char *pathname, char ***confPathname, char ***vertPathname, 
	int &w, int &h, int &d, int &scale, float &stepSize, float &maxLength);

void ReadFibers(const char *confPathname, const char *vertPathname, CFiber **fibers, int &w, int &h);
void ReadFibers(const char *confPathname, const char *vertPathname, CFiber ***fibers, int **count, int &w, int &h);

void SaveFibers(const char *confPathname, const char *vertPathname, CFiber *fibers, const int w, const int h);

void SaveFibers(const char *confPathname, const char *vertPathname, CFiber **fibers, int *count, const int w, const int h);

void SaveFibersAsVTK(const char *pathname, CFiber *fibers, const int count);
void SaveFibersAsVTK(const char *pathname, CFiber **fibers, int *count, const int w, const int h);
